package lesson20;

public class Person 
{
	private String name;
	
	void setName(String name)
	{
		this.name = name;
	}
	
	boolean hasSameName(Person other) throws PersonException
	{
		try
		{
			int[] x = new int[3];
			//x[10] = 4;
			return this.name.equals(other.name);
		}
		catch(NullPointerException e)
		{
			/*for(StackTraceElement ste: e.getStackTrace())
			{
				System.out.println(ste.getMethodName() + ste.getLineNumber());
			}
			System.out.println("Name of you initial person is Null");*/
			throw new PersonException("Fail", e);
		}
		catch (ArrayIndexOutOfBoundsException e) 
		{
			System.out.println("Wrong");
			return false;
		}
	}
}
